package com.stu.day08.shape;

/**
 * 演示:通过把抽象类作为函数参数传递,体现了多态性
 *
 * @author mm
 * @date 2025/1/13 16:42:27
 */
public class ShapeBiz {
    public double girth(AbstractShape shape) {
        return shape.girth();
    }

    public double area(AbstractShape shape) {
        return shape.area();
    }

    public static void main(String[] args) {
        Rect rect = new Rect(10,5);
        Square square = new Square(8);
        Circle circle = new Circle(5);

        ShapeBiz shapeBiz = new ShapeBiz();
        System.out.println(shapeBiz.girth(rect));
        System.out.println(shapeBiz.area(rect));

        System.out.println(shapeBiz.girth(square));
        System.out.println(shapeBiz.area(square));

        System.out.println(shapeBiz.girth(circle));
        System.out.println(shapeBiz.area(circle));
    }
}
